package com.k3cloud.rpc.http.config;

import cn.hutool.extra.spring.SpringUtil;
import org.springframework.stereotype.Component;

import java.io.UnsupportedEncodingException;

@Component
public class RpcHttpConfig {
    public static int connectTimeout;
    public static int socketTimeout;

    public RpcHttpConfig() {
        try {
            String connectTimeoutConfig = new String(SpringUtil.getProperty("dingware.httpClient.connectTimeout").getBytes("ISO-8859-1"), "UTF-8");
            if(connectTimeoutConfig!=null){
                this.connectTimeout = Integer.parseInt(connectTimeoutConfig);
            }
            String socketTimeoutConfig = new String(SpringUtil.getProperty("dingware.httpClient.socketTimeout").getBytes("ISO-8859-1"), "UTF-8");
            if(socketTimeoutConfig!=null){
                this.socketTimeout = Integer.parseInt(socketTimeoutConfig);
            }
        } catch (UnsupportedEncodingException e) {
            throw new RuntimeException(e);
        }
    }
}
